package com.ruoyi.product.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.web.domain.BaseEntity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * 商品列表对象 tb_prod
 *
 * @author ruoyi
 * @date 2025-08-05
 */
@Data
@Document(indexName = "es_product")
@Setting(shards = 1, replicas = 0)
public class ProdEs   {
    private static final long serialVersionUID = 1L;

    /**
     * 商品ID
     */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer prodId;

    /**
     * SPU
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String prodSpu;

    /**
     * 商品类型
     */
    @Field(type = FieldType.Integer)
    private Integer prodKind;

    /**
     * 商品分类
     */
    @Field(type = FieldType.Integer)
    private Integer prodType;

    /**
     * 状态
     */
    @Field(type = FieldType.Integer)
    private Integer prodStatus;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String prodName;

    /**
     * 商品品牌
     */
    @Field(type = FieldType.Integer)
    private Integer brandId;

    /**
     * 商品单位
     */
    @Field(type = FieldType.Integer)
    private Integer unitId;

    /**
     * 商品标签
     */
    @Field(type = FieldType.Integer)
    private Integer tagId;

    /**
     * 供应商
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String appr;

    /**
     * 缩略图
     */
    @Field(type = FieldType.Keyword)
    private String prodImage;

    /**
     * 品牌名称
     */
    @Field(type = FieldType.Keyword)
    private String brandName;

    /**
     * 商品分类名称
     */
    @Field(type = FieldType.Keyword)
    private String typeName;

    /**
     * 创建者
     */
    @Field(type = FieldType.Text)
    private String createBy;

    /**
     * 创建时间
     */
//    @Field(type = FieldType.Date, format = {}, pattern = "yyyy-MM-dd HH:mm:ss")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", shape = JsonFormat.Shape.STRING)
//    private Date createTime;

    @Field(type = FieldType.Date, format = {}, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新者
     */
    @Field(type = FieldType.Text)
    private String updateBy;


    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = {}, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;


}
